package com.example.admin.mapper;


import com.example.common.annotation.AutoFill;
import com.example.model.emp.pojo.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface EmpMapper {

    public List<Employee> list(String name, String gender, String position);

    void delete(List<Integer> ids);
    @AutoFill
    @Insert("insert into sm.employee (name, age, gender, contact_number, photo, position,last_operation_time,last_operator) values " +
            "(#{name},#{age},#{gender},#{contactNumber},#{photo},#{position},#{LastOperationTime},#{lastOperator})")
    void save(Employee employee);
    @Select("select* from sm.employee where employee_id=#{id}")
    Employee selectById(Integer id);
    @AutoFill
    @Update("update sm.employee set name=#{name},age=#{age},gender=#{gender},contact_number=#{contactNumber},photo=#{photo},position=#{position},last_operation_time=#{LastOperationTime} ,last_operator=#{lastOperator} where employee_id=#{employeeId}")
    void updateById(Employee employee);

    /**
     * 登录获取员工信息
     * @param employee
     * @return
     */
    @Select("select * from sm.employee where username=#{username} and password=#{password}")
    Employee getByUsernameAndPassword(Employee employee);

}

